<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // catch  then 都属于 Promise.prototype
        let p = new Promise((resolve, reject) => {
            reject('Error');
            // resolve('success');
        });

        //用于指定失败回调
        // p.catch(reason => {
        //     console.log(reason);
        // });

        //异常(错误)穿透
        p.then(value => {
            console.log(value);
        }).then(value => {
            console.log(value);
        }).catch(reason => {
            console.error(reason);
        });
    </script>
</body>
</html>